package com.example.my_music_palyer.service;

import com.example.my_music_palyer.mapper.LoveMusicMapper;
import com.example.my_music_palyer.model.Music;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class LoveMusicService {
    @Autowired
    private LoveMusicMapper loveMusicMapper;

    public Music findLoveMusicByMusicIdAndUserId(int userId, int musicId) {
        return loveMusicMapper.findLoveMusicByMusicIdAndUserId(userId, musicId);
    }

    public int insertLoveMusic(int userId, int musicId) {
        return loveMusicMapper.insertLoveMusic(userId, musicId);

    }

    public List<Music> findLoveMusicByUserId(int userId) {
        return loveMusicMapper.findLoveMusicByUserId(userId);
    }

    public List<Music> findLoveMusicBykeyAndUID(String musicName, int userId) {
        return loveMusicMapper.findLoveMusicBykeyAndUID(musicName, userId);
    }

    public int deleteLoveMusic(int musicId,int userId){
        return loveMusicMapper.deleteLoveMusic(musicId,userId);
    }

    public int deleteLoveMusicByMusicId(int musicId){
        return loveMusicMapper.deleteLoveMusicByMusicId(musicId);
    }
}
